﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class fuzhi : MonoBehaviour
{
    public Text shuoyuanID;
    public Text chanppinName;
    public Text jingzhong;
    public Text shengchanCode;
    public Text time;
    string objectid;
    string shopId;

    public RawImage QRCodeImage;

    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }
    public void setAll(string shuoyuan_ID, string chanppin_Name, string jing_zhong, string shengchan_Code, string shengchantime, string object_id)
    {
        shuoyuanID.text = shuoyuan_ID;
        chanppinName.text = chanppin_Name;
        jingzhong.text = jing_zhong;
        shengchanCode.text = shengchan_Code;
        time.text = shengchantime;
        objectid = object_id;
        shopId = shuoyuan_ID;
    }
    public string getID()
    {
        return objectid;
    }

    public string getShopID()
    {
        return shopId;
    }

    public void OnEditorButtonClicked()
    {
        StaticVariable.currentObjectId = objectid;
        SceneManager.LoadScene("Editor");

    }

    public void OnDetailButtonClicked()
    {
        StaticVariable.currentObjectId = objectid;
        SceneManager.LoadScene("Detail");
    }

    public void OnQRButtonClicked()
    {
        Debug.Log("OnQRButtonClicked:");
        QRDisplay[] goes = FindObjectsOfType<QRDisplay>();
        foreach(QRDisplay qr in goes)
        {
            qr.gameObject.SetActive(false);
        }
        QRCodeImage.gameObject.SetActive(!QRCodeImage.gameObject.activeSelf);
        StaticVariable.clickedShopId = shopId;
    }


}
